using System;
public class HeroItem : BaseItem
{
	
	private Hero hero;
	
	public UILabel nameLabel;
	
	public UISprite iconSprite;
	public UISprite lockSprite;
	public HeroManager heroManager{
		get{
			return (HeroManager)GameManager.GetInstatnce().GetManager(ManagerType.HERO);
		}
	}
	#region implemented abstract members of BaseItem
	public override void SetItem (object obj)
	{
		hero = (Hero)obj;
		Refresh ();
	}

	public override object GetItem ()
	{
		return hero;
	}
	public override void Refresh ()
	{
		iconSprite.spriteName = hero.data.icon;
		nameLabel.text = hero.data.name;
		if(hero.isOpen){
		    NGUITools.SetActive(lockSprite.gameObject,false);
		}else{
			NGUITools.SetActive(lockSprite.gameObject,true);
		}
	}
	#endregion
	public void SelectHero(){
		heroManager.GetCurSelectHero();
		GameManager.GetInstatnce().ShowPanel(PanelName.MissonPanel);
	}
}


